package cn.com.huzo.service.inventory.impl;

import cn.com.huzo.model.entities.inventory.MaterialInventoryBookHeaderEntity;
import cn.com.huzo.repository.inventory.MaterialInventoryBookHeaderRepository;
import cn.com.huzo.repository.inventory.MaterialInventoryBookLinesRepository;
import cn.com.huzo.service.inventory.MaterialInventoryBookManager;
import huzofw.service.impl.GenericManagerImpl;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 到货供应商数据管理服务对象。
 *
 * @author 吴旭
 */
@Service("MaterialInventoryBookManager")
public class MaterialInventoryBookManagerImpl extends GenericManagerImpl<MaterialInventoryBookHeaderEntity, HashMap>
        implements MaterialInventoryBookManager {

    @Resource(name = "MaterialInventoryBookHeaderRepository")
    private MaterialInventoryBookHeaderRepository _dao_header;

    @Resource(name = "MaterialInventoryBookLinesRepository")
    private MaterialInventoryBookLinesRepository _dao_lines;

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    @Transactional
    public Map<String, Object> fetchMaterialInventoryBook(String styleNo, String materialNo) throws Exception {
        Map<String, Object> _result = new HashMap();

        _result.put("HeaderEntity", _dao_header.fetchMaterialInventoryBookHeader(styleNo));
        _result.put("LinesList", _dao_lines.fetchMaterialInventoryBookLines(styleNo, materialNo));

        return _result;
    }
}
